<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateConfig extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('config', function (Blueprint $table) {
            $table->id();

            $table->string("module", 120)->default("")->comment("模块名称");
            $table->string("name", 120)->default("")->comment("配置名称");
            $table->string("description", 255)->default("")->comment("描述");
            $table->string("type", 48)->default("")->comment("配置类型");
            $table->text("value")->nullable(true)->comment("配置值");

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');

            $table->unique(['name'], 'idx_name');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '配置表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('config');
    }
}
